package com.duruikang.LeaveAPI.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.duruikang.LeaveAPI.entity.Teacher;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @author Drik
 * @date 2021-12-19 9:14
 */

public interface TeacherDao extends BaseMapper<Teacher> {
    /**
     * 查询老师的个人信息
     * @param accountId
     * @return 老师的个人信息
     */
    @Select("   SELECT teacher.teacher_code, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = teacher.teacher_type)AS teacher_type, " +
            "   teacher.name, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = teacher.sex)AS sex, " +
            "   (SELECT sort.name FROM sort WHERE sort.id = teacher.college)AS college, " +
            "   (SELECT sort.name FROM sort  WHERE sort.id = teacher.square)AS square, " +
            "   teacher.photo,teacher.telephone  " +
            "   FROM teacher " +
            "   WHERE teacher.account_id = #{accountId};")
    public Map<String,String> getTeacherInformation(@Param("accountId")String accountId);
}
